import request from '../utils/request'

  // GET login  /api/user/passport/login

  export interface loginModel {
    phone: string,
    password: string
  }

  export interface TokenModel {
    token: string
  }

  // 个人信息接口类型
  export interface UserInfoFun {
    id: number | undefined,
    loginName: string,
    nickName: string,
    passwd: string,
    name: string,
    phoneNum: string,
    email: string,
    headImg: string,
    userLevel: string,
    status: number | undefined,
    birthday: null,
    gender: null,
    createTime: string,
    operateTime: null,
    openId: null
  }


export default {
  // 登录
  login(data: loginModel) {
    return request.post<any, TokenModel>(`/user/passport/login`,data)
  },
  // 获取个人信息
  reqUserInfo() {
    return request.get<any, UserInfoFun>(`/user/passport/auth/getUserInfo`)
  },
  // 退出登录
  logout() {
    return request.get<any, null>(`/user/passport/logout`)
  }
}